package com.zens.cms.utils;

import java.io.InputStreamReader;
import java.io.LineNumberReader;

public class ThumbnailConvert {

	private String CMYK_COMMAND = "mogrify -colorspace RGB -quality 80 file1";
	
	public void setCMYK_COMMAND(String file){
		execCommand(CMYK_COMMAND.replace("file1", file));
	}
	
	public boolean execCommand(String cmd){
		InputStreamReader reader = null;
		LineNumberReader numberReader = null;
		try{
			Process process = Runtime.getRuntime().exec(cmd);
			reader = new InputStreamReader(process.getInputStream());
			numberReader = new LineNumberReader(reader);
			while((numberReader.readLine()) != null){
				reader.close();
				numberReader.close();
			}
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
		return true;
	}
}
